package com.coc.controller;

import com.coc.pojo.Dept;
import com.coc.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/queryDepts")
    public Object queryDepts() {
        return deptService.queryDepts();
    }

    @GetMapping("/add")
    public Integer add(Dept dept) {
        return deptService.add(dept);
    }

    @GetMapping("/delete")
    public Integer delete(Integer deptNo) {
        return deptService.delete(deptNo);
    }
    @GetMapping("/getById")
    public Dept getById( Integer deptNo) {
        System.out.println(deptNo);
        return deptService.selectById(deptNo);
    }

}
